services:
  loki:
    container_name: loki
    image: docker.io/grafana/loki:3.5.8
    command: "-config.file=/etc/loki/config.yaml"
    ports:
      # --> (Optional) Remove when using traefik...
      - "3100:3100"
      # <--
    volumes:
      - ./config/config.yaml:/etc/loki/config.yaml:ro
      - data_loki:/loki:rw
    # --> (Optional) When using traefik...
    # labels:
    #   - traefik.enable=true
    #   - traefik.docker.network=frontend
    #   # -- Traefik Services
    #   - traefik.http.services.loki.loadbalancer.server.port=3100
    #   # -- Traefik Routers
    #   - traefik.http.routers.loki.entrypoints=websecure
    #   - traefik.http.routers.loki.rule=Host(`loki-fqdn`)
    #   - traefik.http.routers.loki.tls=true
    #   - traefik.http.routers.loki.tls.certresolver=cloudflare
    #   - traefik.http.routers.loki.service=loki
    #   # -- (Optional) Authentication
    #   # - traefik.http.routers.loki.middlewares=authentik-middleware@file
    # networks:
    #   - frontend
    # <--
    restart: unless-stopped

volumes:
  data_loki:
    driver: local

# --> (Optional) When using traefik...
# networks:
#   frontend:
#     external: true
# <--
